home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI1105.ASC < prev    next >
Text File  |  1992-08-17  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Paradox                               NUMBER  :  1105
  8.   VERSION  :  4.0
  9.        OS  :  DOS
  10.      DATE  :  August 17, 1992                          PAGE  :  1/2
  11.  
  12.     TITLE  :  Using Immediate If to Eliminate Blank Spaces In
  13.               Reports
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   This Technical Information sheet is intended for someone with a
  20.   moderate level of Paradox knowledge.
  21.  
  22.   Prerequisites:
  23.   A basic understanding of the Paradox Report Generator.  A
  24.   familiarity with using calculated fields.
  25.  
  26.   Purpose:
  27.   This Technical Information sheet illustrates how you can use the
  28.   PAL Immediate If function, IIF(), to eliminate the blank spaces
  29.   that are produced when concatenating fields together where one of
  30.   the fields is blank.
  31.  
  32.   Occasionally it may be desirable to print reports wherein one of
  33.   the fields on a line of the report may be empty.  A common
  34.   example is printing out the first, middle and last name fields on
  35.   a line where the middle field may be blank.  Suppose the fields
  36.   [F], [M] and [L] represent the fields First Name, Middle Name,
  37.   and Last Name respectively.  In such a scenario, using
  38.   fieldsqueeze or a calculated field with the expression [F] + " "
  39.   + [M] + " " + [L] will result in extra spaces being printed if
  40.   the "M" field is blank.  The Paradox 4.0 Immediate If PAL
  41.   function, IIF(), can be used to eliminate the blank spaces that
  42.   are produced when concatenating fields together where one of the
  43.   fields is blank.
  44.  
  45.   The Immediate If function returns one of two values depending on
  46.   the value of a logical condition.  The syntax of the Immediate If
  47.   function is as follows:
  48.  
  49.     IIF(Condition, ValueIfTrue, ValueIfFalse)
  50.  
  51.   The example below removes the extra space encountered when
  52.   the "Middle" field is blank.  Use the following expression in a
  53.   calculated field:
  54.  
  55.     IIF(ISBLANK([M]), [F] + " " + [L], [F] + " " + [M] + " " + [L])
  56.  
  57.   The expression ISBLANK([M]) evaluates whether the "M" field is
  58.   blank.  If the "M" field is blank, Paradox concatenates the "F"
  59.   and "L" fields separating them by one space.  If the "M" field is
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.   PRODUCT  :  Paradox                               NUMBER  :  1105
  74.   VERSION  :  4.0
  75.        OS  :  DOS
  76.      DATE  :  August 17, 1992                          PAGE  :  2/2
  77.  
  78.     TITLE  :  Using Immediate If to Eliminate Blank Spaces In
  79.               Reports
  80.  
  81.  
  82.  
  83.  
  84.   not blank, Paradox concatenates the "F", "M" and "L" fields
  85.   separating each of the fields by one space.
  86.  
  87.   The example below compares the results of using the IIF() vs.
  88.   using Fieldsqueeze.  Notice that Fieldsqueeze incorporates two
  89.   extra blank spaces when the "M" field is blank, whereas IIF()
  90.   properly concatenates the fields.
  91.  
  92.   Field Values           Report Field        Report Field
  93.                          Using IIF()            Using
  94.   F      M    L                              Fieldsqueeze
  95.   -----------------      -------------      --------------
  96.   John   R.   Smith      John R. Smith      John R. Smith
  97.   Mary        Jones      Mary Jones         Mary  Jones
  98.  
  99.   The IIF() expression can be placed in calculated fields in both
  100.   reports and forms, provided that the expression is no longer than
  101.   175 characters in length.  There are many possible ways to use
  102.   IIF().  When implementing the Immediate If function, it is a good
  103.   idea to test for all possible values to achieve the desired
  104.   results.
  105.  
  106.   For additional information about PAL, refer to the PAL Reference
  107.   Guide.
  108.  
  109.   DISCLAIMER: You have the right to use this technical information
  110.   subject to the terms of the No-Nonsense License Statement that
  111.   you received with the Borland product to which this information
  112.   pertains.
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.